layui.use(['element', 'layer', 'form'], function(){
	var element = layui.element(),
        $ = layui.jquery;
  	$("#select-child").on('mouseleave', function(){
  		$(this).removeClass('layui-show');
  	}).find('dd').on('click', function(){
  		var text = $(this).text().trim();	
  	})
  	
  	
  	//列表页，移入图片，显示大图
  	$(document).on('mouseenter','.img-hover-show', function(e){
  		var imgsrc = $(this).attr('src');
  		var imghtml = $('<div class="bigimg-show" id="bigimg-show"><img src="' + imgsrc + '"></div>');
  		imghtml.appendTo($('body'));
  	}).on('mousemove','.img-hover-show', function(e){
  		var clientX = e.clientX,
  			clientY = e.clientY;
  			console.log($("#bigimg-show").length);
  		$("#bigimg-show").css({
  			left: clientX + 12,
  			top: clientY - 10
  		}).fadeIn(200);
  	}).on('mouseleave','.img-hover-show', function(e){
  		$("#bigimg-show").remove();
  	});
  	

    (function($){
      var count = 0;
      var timer;
    	$(document).on('mouseenter', '.detail-tips-hover', function(e){
    		var tips = $(this).html();
    		var that = this;
    		timer = setInterval(function(){
          count = count + 100;
          if(count > 500){
            layer.tips(tips, $(that), {
              tips: [1, '#5FB878']
            });
            clearInterval(timer);
            count = 0;
          }
    		},100);
    		
    	}).on('mouseleave', '.detail-tips-hover', function(){
        clearInterval(timer);
        count = 0;
    		setTimeout(function(){
    			layer.closeAll();
    		}, 500)
    	});
    })(jQuery);
  	
  	//计算table的高度，需要操作table的加上class
	$(window).on('resize', function () {
		if($(".submain-complextable").length > 0){
			var complextableOffsetTop = $(".submain-complextable").offset().top;
        	$(".submain-complextable").height($(window).height() - complextableOffsetTop -20).css("overflow-y","auto");
		}
	}).resize();
	
	
	//预购数量验证
	var preOrderNum = {
	}
  
});
